package designpattern.abstractfactory.generator;

import designpattern.abstractfactory.factory.AbstractFactory;

public class FactoryGenerator {
    public static AbstractFactory getFactory(Class<? extends AbstractFactory> clazz){
        if (clazz == null){
            throw new RuntimeException("类路径不能为空");
        }
        AbstractFactory abstractFactory = null;
        try {
            abstractFactory = clazz.newInstance();
        }catch (Exception e){
            System.out.println("获取类发生异常 "+e.getMessage());
            e.printStackTrace();
        }
        return abstractFactory;
    }
}
